<template>
  <div class="table">
    <el-card class="table-card">
      <el-row type="flex" justify="center">
        <el-col>
          <el-table :data="userData" stripe style="width: 100%" size="medium">
            <el-table-column prop="username" label="姓名" width="280">
            </el-table-column>
            <el-table-column prop="password" label="密码" width="280">
            </el-table-column>
          </el-table>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script>
import { getAllUser } from "@/api/user";
export default {
  data() {
    return {
      userData: [],
    };
  },
  methods: {
    async findAll() {
      const result = await getAllUser();
      this.userData = result;
    },
  },
  created() {
    this.findAll();
  },
};
</script>

<style>
.table {
  /* width: 800px; */
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.table-card {
  padding: 10px;
  margin: 0 20px;
}
</style>